package com.example.demo.config;

import org.springframework.context.annotation.Configuration;
import org.springframework.web.servlet.config.annotation.InterceptorRegistry;
import org.springframework.web.servlet.config.annotation.PathMatchConfigurer;
import org.springframework.web.servlet.config.annotation.WebMvcConfigurer;

/**
 * @program: demo
 * @author: JCM
 * @create: 2023-04-24 09:25
 * @description:
 **/
@Configuration
public class AppConfig implements WebMvcConfigurer {
    // 添加拦截器
    public void addInterceptors(InterceptorRegistry registry) {
//        registry.addInterceptor(new LoginInterceptor())
//                .addPathPatterns("/**") // 拦截所有接口
//                .excludePathPatterns("/user/login")
//                .excludePathPatterns("/**/*.html")  // 解决一直重定向
//                .excludePathPatterns("/user/reg");
    }

    /**
     * 为接口添加统一前缀
     */
//    @Override
//    public void configurePathMatch(PathMatchConfigurer configurer) {
//        configurer.addPathPrefix("lisi", c -> true);
//    }
}
